package study.chapter4;

import java.util.Scanner;
public class C4NestingBranch {

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入现在的季节：");
        int season = scanner.nextInt();
        System.out.println("请输入买票人年龄：");
        int age = scanner.nextInt();
        double price;

        if (season == 1){
            price = 30;
            if (age > 0 & age <= 6){
                price = price * 0;
                System.out.println("票价：" + price);
            }else if (age > 6 & age <=22){
                price = price * 0.5;
                System.out.println("票价：" + price);
            }else if (age > 22 & age < 60){
                price = price * 1;
                System.out.println("票价：" + price);
            }else if (age >= 60 & age < 110){
                price = price * 0.3;
                System.out.println("票价：" + price);
            }else {
                price = 9999;
                System.out.println("你输入的年龄不合法！");
            }

        }
    }
}
